package com.googlecode.grima.job;

import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;

public class HerokuNotIdleJob {

	private static final Logger LOG = LoggerFactory.getLogger(HerokuNotIdleJob.class);

	@Scheduled(fixedDelay=120000)
	public void herokuNotIdle(){
	    LOG.debug("Heroku not idle execution");
	    
	    URL url;
      try {
	      url = new URL("http://grima.herokuapp.com");
		    HttpURLConnection connection = (HttpURLConnection)url.openConnection();
		    connection.setRequestMethod("GET");
		    connection.connect();
		    InputStream stream = connection.getInputStream();
		    System.out.println(stream);
      } catch (Exception e) {
	      e.printStackTrace();
      }

	    
	}
	
}
